package com.heima.user.controller;

import com.heima.common.dto.PageResponseResult;
import com.heima.common.dto.ResponseResult;
import com.heima.user.dto.ApplyDto;
import com.heima.user.dto.RealNameDto;
import com.heima.user.entity.ApUserRealname;
import com.heima.user.service.IApUserRealnameService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * APP实名认证信息表 前端控制器
 * </p>
 *
 * @author SpaceTraveller
 * @since 2022-11-07
 */
@RestController
@RequestMapping("/api/v1/user_realname")
@Api(tags = "APP实名认证信息表接口")
public class ApUserRealnameController{

    @Autowired
    private IApUserRealnameService realNameService;

    @PostMapping("/list")
    @ApiOperation(value = "请求创建自媒体帐户实名数据",notes = "author:SpaceTraveller")
    @ApiImplicitParam(name = "dto",value = "请求体对象",required = true,dataType = "RealNameDto")
    public PageResponseResult<List<ApUserRealname>> listAppUserRealName(@RequestBody RealNameDto dto){
        return realNameService.listAppUserRealName(dto);
    }

    /**
     * 驳回申请
     * @param dto
     * @return
     */
    @PostMapping("/authFail")
    @ApiOperation(value = "驳回申请",notes = "author:SpaceTraveller")
    @ApiImplicitParam(name = "dto",value = "请求体对象",required = true,dataType = "ApplyDto")
    public ResponseResult authFail(@RequestBody ApplyDto dto){
        return realNameService.authFail(dto);
    }

    /**
     * 同意申请
     * @param dto
     * @return
     */
    @PostMapping("/authPass")
    @ApiOperation(value = "同意申请",notes = "author:SpaceTraveller")
    @ApiImplicitParam(name = "dto",value = "请求体对象",required = true,dataType = "ApplyDto")
    public ResponseResult authPass(@RequestBody ApplyDto dto){
        return realNameService.authPass(dto);
    }


}
